home *** CD-ROM | disk | FTP | other *** search
/ Precision Software Appli…tions Silver Collection 1 / Precision Software Applications Silver Collection Volume One (PSM) (1993).iso / tutor / clipper.exe / CLIPNDX.PRG < prev    next >
Text File  |  1985-07-29  |  4KB  |  172 lines

  1. * clipwage.PRG
  2. SELE 2
  3. USE CLIPstru.str
  4. sele 1
  5. use clipwage
  6. go bott
  7. totrecs = recno()
  8. clear
  9. sele 2
  10. SET COLO TO 7/0,R/W
  11. @ 1,0 SAY   "╔══════════════════════════════════════════════════════════════════════════════╗"
  12. @ 2,0 SAY   "║"
  13. Set Color To w+/r, R/W
  14. @ 2,1 SAY    "                  C L I P P E R  dBASE III True compiler                      "
  15. SET COLO TO 7/0,R/W
  16. @ 2,79 SAY  "║"
  17. @ 3,0 SAY   "║"
  18. Set Color To w+/r, R/W
  19. @ 3,1 SAY    "                                                                              "
  20. SET COLO TO 7/0,R/W
  21. @ 3,79 SAY  "║"
  22. @ 4,0 SAY   "║"
  23. Set Color To w+/r, R/W
  24. @ 4,1 SAY    "       Demonstration of INDEX CREATION on a database of " + str(totrecs,3,0) + " records           "
  25. SET COLO TO 7/0,R/W
  26. @ 4,79 SAY  "║"
  27. @ 5,0 SAY   "║"
  28. Set Color To w+/r, R/W
  29. @ 5,1 SAY   "                     USING CLIPPER'S OWN INDEXING ALGORITHM                    "
  30. SET COLO TO 7/0,R/W
  31. @ 5,79 SAY  "║"
  32. @ 6,0 SAY   "╚══════════════════════════════════════════════════════════════════════════════╝"
  33. SET COLO TO 7+/0,R/W
  34. @ 8,10 SAY   "┌────────────────────────┐"
  35. @ 9,10 SAY   "│"
  36. @ 9,35 say   "│"
  37. @ 10,10 say  "│"
  38. @ 10,35 say  "│"
  39. @ 11,10 say  "│"
  40. @ 11,35 say  "│"
  41. @ 12,10 say  "│"
  42. @ 12,35 say  "│"
  43. @ 13,10 say  "│"
  44. @ 13,35 say  "│"
  45. @ 14,10 say  "│"
  46. @ 14,35 say  "│"
  47. @ 15,10 say  "│"
  48. @ 15,35 say  "│"
  49. @ 16,10 say  "│"
  50. @ 16,35 say  "│"
  51. @ 17,10 say  "│"
  52. @ 17,35 say  "│"
  53. @ 18,10 say  "│"
  54. @ 18,35 say  "│"
  55. @ 19,10 say  "│"
  56. @ 19,35 say  "│"
  57. @ 20,10 SAY  "└────────────────────────┘"
  58.  
  59. x = 12
  60. *
  61. *  print out all fields in the structure extended
  62. *
  63. SET COLO TO 7+/0,7+/0
  64. @ 9,12 SAY   'Fields in Structure :'
  65. @ 10,12 SAY   '===================  '
  66. SET COLO TO R/0,R+/0
  67. do while .not. eof()
  68.   @ x,15 say str(x-11,2,0) + '   ' + field_name
  69.   x = x + 1
  70.   skip
  71. enddo
  72. SET COLO TO 7+/0,7+/0
  73. @ 12,45 SAY  "┌─────────────────────────┐"
  74. @ 13,45 say  "│  Enter the number of    │"
  75. @ 14,45 say  "│   the field you wish    │"
  76. @ 15,45 say  "│  to create an index for │" 
  77. @ 16,45 say  "│        -->              │"
  78. @ 17,45 SAY  "└─────────────────────────┘"
  79. sel = 0
  80. SET COLO TO w+/r,w+/r
  81. @ 16,61 get sel pict "9"
  82. read
  83. clear gets
  84. sele 2
  85. do case
  86.   case sel = 1
  87.     goto 1
  88.     fname = field_name
  89.     FTYPE  = FNAME
  90.     FCLASS = FIELD_TYPE
  91.   case sel = 2
  92.     goto 2
  93.     fname = field_name
  94.     FTYPE  = FNAME
  95.     FCLASS = FIELD_TYPE
  96.   case sel = 3
  97.     goto 3
  98.     fname = field_name
  99.     FTYPE  = FNAME
  100.     FCLASS = FIELD_TYPE
  101.   case sel = 4
  102.     goto 4
  103.     fname = field_name
  104.     FTYPE  = FNAME
  105.     FCLASS = FIELD_TYPE
  106.   case sel = 5
  107.     goto 5
  108.     fname = field_name
  109.     FTYPE  = FNAME
  110.     FCLASS = FIELD_TYPE
  111.   case sel = 6
  112.     goto 6
  113.     fname = field_name
  114.     FTYPE  = FNAME
  115.     FCLASS = FIELD_TYPE
  116.   case sel = 7
  117.     goto 7
  118.     fname = field_name
  119.     FTYPE  = FNAME
  120.     FCLASS = FIELD_TYPE
  121.   case sel = 8
  122.     goto 8
  123.     fname = field_name
  124.     FTYPE  = FNAME
  125.     FCLASS = FIELD_TYPE
  126. endcase
  127. SET COLO TO 7/0,7/0
  128. X = 12
  129. DO WHILE X < 18
  130.   @ X,45 SAY "                           "
  131.   X = X + 1
  132. ENDDO
  133. SET COLO TO /w,/w
  134. @ 12,45 SAY  "┌─────────────────────────┐"
  135. @ 13,45 say  "│  Now creating an index  │"
  136. @ 14,45 say  "│  on field               │"
  137. @ 14,57 say fname
  138. @ 15,45 say  "│  in correct format for  │"
  139. @ 16,45 say  "│     use by CLIPPER      │"
  140. @ 17,45 SAY  "└─────────────────────────┘"
  141. if file("userndx.ntx")
  142.   dele file userndx.ntx)
  143. endif
  144. if file("userndx.ndx")
  145.   dele file userndx.ndx
  146. endif
  147. SELE 1
  148. if fclass = 'C'
  149.   index on upper(&fname) to userndx
  150. else
  151.   index on &fname to userndx
  152. endif
  153. Set Color To w+/r,w/r
  154. @ 12,45 SAY  "┌─────────────────────────┐"
  155. @ 13,45 say  "│  Index is completed     │"
  156. @ 14,45 say  "│  on field               │"
  157. @ 14,57 say fname
  158. @ 15,45 say  "│  Do you want to examine │"
  159. @ 16,45 say  "│  the data using it ?    │"
  160. @ 17,45 say  "│       -->               │"
  161. @ 18,45 SAY  "└─────────────────────────┘"
  162. view = .t.
  163. @ 17,60 get view
  164. read
  165. clear gets
  166. set color to 7/0,7/0
  167. if view
  168.   do clipview
  169. ELSE
  170.   return
  171. endif
  172.